import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.住院护士站.住院护士站.hulijilu__page import hulijibie
from page.住院护士站.住院护士站.yizhuzhixing__page import yizhuzhixing
from page.住院护士站.住院护士站.zhuyuanhushizhan__page import zhuyuanhushizhan
from page.住院护士站.住院护士站.zidongjifei__page import zidongjifei
from tools.sjqd_way import read_data_from_excel
class TestZhuyuanhushizhan_Yijizhixing(BASECASE):
    @classmethod
    def setUpClass(cls):
        ap = IndexPage()
        ap.jrym_no1('住院护士站')
    @classmethod
    def tearDownClass(cls):
        ap = IndexPage()
        ap.close_all_xxk()
        print("{}执行完毕-------------------------------------------------".format(cls))
    #执行医嘱
    def test_1_zhuyuanhushizhan_zhixingyizhu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        bp = zhuyuanhushizhan()
        bp.input_hzxx(name)  #输入住院患者姓名
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "执行医嘱")
        bq,ks,yzfl,yzzt,yz1,yz2=self.data[0]
        bp.choose_bq(bq)  # 选择病区
        bp.click_cx_btn() #点击查询按钮
        bp.click_yzzx_btn()  #点击医嘱执行按钮
        cp = yizhuzhixing()
        cp.choose_ks(ks)#选择科室
        cp.choose_yzfl(yzfl)#选择医嘱分类
        cp.choose_yzzt(yzzt)#选择医嘱状态
        cp.input_hzxm(name)#输入患者姓名
        cp.execute_yz(yz1)
        cp.click_tsqx_btn()#点击提示取消按钮
        cp.execute_yz(yz2)
        cp.click_tsqx_btn()  # 点击提示取消按钮
        cp.close_window()#关闭窗口
    #添加自动收费
    # @unittest.skip
    def test_2_zhuyuanhushizhan_add_zidongjifei(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "自动计费")
        zdjf = self.data[0][0]
        bp = zhuyuanhushizhan()
        bp.ckick_zdjf()#点击自动计费
        cp = zidongjifei()
        cp.click_xz_btn()#点击新增
        cp.choose_xm(zdjf)
        cp.click_add()#点击添加按钮
        cp.click_tj()#点击提交
        cp.close_window()#关闭窗口

    # 添加护理级别
    # @unittest.skip
    def test_3_zhuyuanhushizhan_add_hulijibie(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "护理级别")
        hljb = self.data[0][0]
        bp = zhuyuanhushizhan()
        bp.click_hljb()
        cp = hulijibie()
        cp.input_hljb(hljb)  # 变更护理级别
        cp.click_bc_btn()  # 点击保存
if __name__ == '__main__':
    unittest.main()
